package com.reverie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.reverie.entity.CategoryRelGood;
import com.reverie.mapper.CategoryRelGoodMapper;
import com.reverie.service.ICategoryRelGoodService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryRelGoodServiceImpl extends ServiceImpl<CategoryRelGoodMapper, CategoryRelGood> implements ICategoryRelGoodService {
    @Override
    public boolean removeByCategoryId(String categoryId) {
        QueryWrapper<CategoryRelGood> wrapper = new QueryWrapper<>();
        wrapper.lambda().eq(CategoryRelGood::getCategoryId, categoryId);
        return remove(wrapper);
    }

    @Override
    public List<CategoryRelGood> queryGoods(Integer categoryId) {
        QueryWrapper<CategoryRelGood> wrapper = new QueryWrapper<>();
        wrapper.lambda().eq(CategoryRelGood::getCategoryId, categoryId);
        return list(wrapper);
    }
}
